package com.example.flashsales.mappers;

import com.example.flashsales.entity.dto.RefundDetailsDto;
import com.example.flashsales.entity.dto.RefundDto;
import com.example.flashsales.entity.pojo.ReturnOrder;
import com.example.flashsales.entity.pojo.ReturnOrderDetails;
import com.example.flashsales.entity.vo.ReturnOrderVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface RefundMapper {

    //增加一条退货纪录
    int refund(RefundDto refundDto);

    //增加退款细节
    int addDetails(RefundDetailsDto refundDetailsDto);

    //退款细节
    List<ReturnOrderDetails> viewRefundDetails(@Param("refundId") long refundId);

    //退款订单
    ReturnOrder viewRefund(@Param("refundId")long refundId);

    //获取退款订单id集合
    List<Integer> viewRefundId(@Param("page") int page,@Param("num") int num);

    //根据状态获取
    List<Integer> viewRefundByState(@Param("state") int state,@Param("page") int page,@Param("num") int num);

    //用户根据状态获取
    List<Integer> viewAllRefundByUserAndState(@Param("state") long state, @Param("integer") Integer integer);

    //修改退货订单的细节
    int updateDetailsState(@Param("detailsId") long detailsId, @Param("state") int state);

    //修改退货订单状态
    int updateState(@Param("state") int state, @Param("refundId") long refundId, @Param("adminId") int adminId);

    //根据细节id获取订单id
    long viewRefundDetailsInRefundId(@Param("detailsId") long detailsId);

    //根据订单id获取退货订单
    List<ReturnOrder> viewRefundByOrderId(@Param("orderId") long orderId);

    //取消退款订单
    int cancelRefundOrder(@Param("refundId") Long refundId);

    //根据类型查看总数
    Integer viewCountByState(@Param("state") Integer state);

    //查看所有数量
    Integer viewCount();

    //获取退货订单id
    List<Integer> viewIdByOrderId(@Param("orderId") Integer integer);
}
